package com.oro.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;

/**
 * Entity implementation class for Entity: Email
 * 
 */
@Entity
public class Email implements Serializable {

	private static final long serialVersionUID = 1L;
	@Transient
	public static final String TYPE_CONFIDENTIAL = "Confidential";
	@Transient
	public static final String TYPE_GENERIC = "Generic";
	@Transient
	public static final String TYPE_HOME = "Home";
	@Transient
	public static final String TYPE_LEISURE = "Leisure";
	@Transient
	public static final String TYPE_PERSONAL = "Personal";
	@Transient
	public static final String TYPE_PUBLIC = "Public";
	@Transient
	public static final String TYPE_WORK = "Work";

	@Transient
	private static final List<String> types = new ArrayList<String>() {
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		{
			add(Email.TYPE_GENERIC);
			add(Email.TYPE_PERSONAL);
			add(Email.TYPE_WORK);
			add(Email.TYPE_PUBLIC);
			add(Email.TYPE_CONFIDENTIAL);
			add(Email.TYPE_LEISURE);
			add(Email.TYPE_HOME);
		}
	};

	public static String getTypeConfidential() {
		return TYPE_CONFIDENTIAL;
	}

	public static String getTypeGeneric() {
		return TYPE_GENERIC;
	}

	public static String getTypeHome() {
		return TYPE_HOME;
	}

	public static String getTypeLeisure() {
		return TYPE_LEISURE;
	}

	public static String getTypePersonal() {
		return TYPE_PERSONAL;
	}

	public static String getTypePublic() {
		return TYPE_PUBLIC;
	}

	public static List<String> getTypes() {
		return types;
	}

	public static String getTypeWork() {
		return TYPE_WORK;
	}

	private String email;

	@Id
	@GeneratedValue
	private Long id;

	private String type;

	public Email() {
		super();
		this.type = Email.TYPE_GENERIC;
	}

	public Email(String email) {
		this();
		this.email = email;
	}

	public Email(String email, String type) {
		this(email);
		this.type = type;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o != null) {
			if (o instanceof Email) {
				return this.getEmail() == ((Email) o).getEmail()
						& this.getType() == ((Email) o).getType();
			} else
				return false;
		} else
			return false;
	}

	public String getEmail() {
		return email;
	}

	public Long getId() {
		return id;
	}

	public String getType() {
		return type;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setType(String type) {
		this.type = type;
	}
}
